let Mock = require("mockjs")
let Random = Mock.Random
Random.cname()
Random.natural(1, 20)
Random.extend({
    phone: function () {
        var phonePrefixs = ['132', '135', '189'] // 自己写前缀
        return this.pick(phonePrefixs) + Mock.mock(/\d{8}/) //Number()
    },
    // 宠物分类名
    petclassname: function () {
        var petPrefixs = "宠物"
        return this.pick(petPrefixs) + Mock.mock(/鱼|蛇|狗|猫|鸟|龟|鼠|蜥蜴/)
    },
    varieties: function () {
        return Mock.mock(/鱼|蛇|狗|猫|鸟|龟|鼠|蜥蜴/)
    },
    // 用户信息
    // user: function () {
    //     var userPrefixs = "user"
    //     return this.pick(userPrefixs) + Mock.mock(
    //         '@natural(1, 20)'
    //     )

    // }
})


Random.phone()
Random.region()
// 管理员信息管理数据
let admininformanage = {
    "admin|5": [{
        "admin|1-3": "admin",
        "phone": "@phone",
        "name": "@cname",
        "address": "@region",
    }]
}
// 用户信息管理数据
let userinformanage = {
    "userinfo|7": [{
        "user": "user"+"@natural(1, 20)",
        "phone": "@phone",
        "name": "@cname",
        "address": "@region",
    }]
}
// 宠物信息管理数据
let petinformanage = {
    "petinfor|7": [{
        "name": "@cname",
        "age|1-10": 2,
        "address": "@region",
        "petclassname": "@petclassname",
        "describe": "暂无描述",
        "state": "已领养",

    }]
}
// 宠物分类数据
let petclassification = {
    "petclass|5": [{
        "petclassname": "@petclassname",
        "varieties": "@varieties"
    }]
}
// 领养申请
let applyadoption = {
    "applyadoption|5": [{
        "name":"user"+"@natural(1, 20)",
        "phone":"@phone",
        "address": "@region",
        "petname":"可爱"+"@natural(1, 20)",
        "petclassname": "@petclassname",
        "state": "待审批"
    }]
}



Mock.mock("/admininformanage", "get", admininformanage)
Mock.mock("/userinformanage", "get", userinformanage)
Mock.mock("/petclassification", "get", petclassification)
Mock.mock("/petinformanage", "get", petinformanage)
Mock.mock("/applyadoption", "get", applyadoption)